<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php $this->load->view('head'); ?>
</head>

<body>
	<?php $this->load->view('header_admin.php'); ?>
	
	<!-- Content Area -->
	<div class="wrapper-world content">
		<h1><?php echo $pageTitle; ?></h1>
		<!-- <div class="wrapper">
			<?php echo form_open('/users', 'class="standard-form"'); ?>
				<div class="type-text"><input type="text" name="search" /></div>
				<div class="type-btn"><input type="submit" value="Search" /></div>
				<div class="clr"></div>
			</form>
		</div> -->
		<div class="job-listing">
			<div class="wrapper-world"> <!-- zaglaviq -->
				<div class="wrapper">
                    <div class="job-id">Job ID</div>
					<!--div class="job-id">Quotation ID</div-->
					<div class="job-details">Customer</div>
					<div class="job-status">Date</div>
					<div class="job-price">Invoice Amount</div>
                    <div class="job-price">Unpaid Amount</div>
					<div class="clr"></div>
				</div>
			</div>
			
			<?php $c = 0; foreach ($invoices as $invoice): ?>
			<div class="wrapper-world job-<?php echo (($c%2 == 0) ? "odd" : "even"); ?>">
				<div class="wrapper">
                                    <?php 
                                    $jobidstring = str_replace("-", "", $invoice->date);
                                    //$jobidstring .= "-" . number_format($invoice->jid, -4);
									$jobidstring .= "-" .str_pad($invoice->jid, 4, "0", STR_PAD_LEFT);
                                    ?>
                    <div class="job-id"><?php echo anchor('/joborder/'.$invoice->jid, $jobidstring); ?></div>
					<!--div class="job-id"><?php //echo anchor('/invoices/view/'.$invoice->id, $invoice->id); ?></div-->
					<div class="job-details">
					<?php if($invoice->uinfo):?>
						<?php if($invoice->uinfo->name!='') 
								echo anchor('/viewuser/'.$invoice->uinfo->id, $invoice->uinfo->name); 
							else
								echo anchor('/viewuser/'.$invoice->uinfo->id, "Unknown"); 
						?>
						<?php if ($invoice->uinfo->company): ?> from 
							<?php //echo anchor('/companies/view/'.$invoice->uinfo->company->id, $invoice->uinfo->company->name); 
								 echo $invoice->uinfo->company;?>
						<?php endif; ?>
					<?php endif; ?>
					</div>
					<div class="job-status"><?php echo $invoice->date; ?></div>
					<div class="job-price"><?php echo $this->Jobs->formatPrice($invoice->grandtotal); ?></div>
                    <div class="job-price"><?php echo $this->Jobs->formatPrice($invoice->unpaid); ?></div>
					<div class="clr"></div>
				</div>
			</div>
			<?php $c++; endforeach; ?>
		</div>
                
	</div> <!-- end of wrapper-world and .content -->
	
	
		
	<div class="wrapper-world footer-top">
		<div class="wrapper"></div>	
	</div>
	
	<?php $this->load->view('footer'); ?>
</body>
</html>
